package com.rc.saas.mini.common.utils;


import com.rc.saas.mini.common.constant.CommonConstant;

public class StringUtil {
	//public static boolean isBlank(String str) {
	//	if (str == null || str.length() == 0) {
	//		return true;
	//	}
	//	return false;
	//}
	//
	//public static boolean isNotBlank(String str) {
	//	return !isBlank(str);
	//}

	public static String getGetterMethodName(String fieldName) {
		String getter = CommonConstant.CONSTANT_STRING_GET + toUpperCaseFirstLetter(fieldName);
		return getter;
	}

	public static String getSetterMethodName(String fieldName) {
		String setter = CommonConstant.CONSTANT_STRING_SET + toUpperCaseFirstLetter(fieldName);
		return setter;
	}

	public static String toUpperCaseFirstLetter(String str) {
		return str.substring(0, 1).toUpperCase() + str.substring(1);
	}

	public static String toLowerCaseFirstLetter(String str) {
		return str.substring(0, 1).toLowerCase() + str.substring(1);
	}

	/**
	 * 隐藏手机号码
	 *
	 * @param mobile
	 * @return
	 */
	public static String encodeMobile(String mobile) {
		if (mobile == null || mobile.length() < 7) {
			return "该手机错误";
		}
		return mobile.substring(0, 3) + "****" + mobile.substring(7);
	}

}
